home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / pascal / gpc1.1p2 / gpc1 / usr / src / gpc-1.1p2-2.6.3 / contrib / xbgi.ph < prev   
Encoding:
Text File  |  1995-04-20  |  7.3 KB  |  249 lines

  1.  
  2. { BGI graphics interface module.
  3.  
  4.   This interface module defines the BGI interfaces to be used with the
  5.   XBGI library written by Peter King <king@physics.su.oz.au>
  6.  
  7.   You should put
  8.  
  9. #include "xbgi.ph"
  10.  
  11.   or something like that in front of your pascal source code.
  12.  
  13.   Author: Juki <jtv@hut.fi>
  14.  
  15.   This has been used only to test two tiny programs, so it is not
  16.   likely to be correct.....
  17.  
  18.   Please send me your improvements.
  19. }
  20.  
  21. MODULE bgi Interface;
  22.  
  23. EXPORT BgiGraphics =
  24.             (Arc,Bar,Bar3D,Circle,ClearDevice,ClearViewport,CloseGraph,
  25.          DetectGraph,DrawPoly,FillEllipse,FillPoly,FloodFill,
  26.          GetAspectRatio,GetbkColor,GetColor,GetFillPattern,GetImage,
  27.          GetMaxColor,GetMaxMode,GetMaxX,GetMaxY,GetModeName,
  28.          GetModeRange,GetPixel,GetX,GetY,GraphDefaults,
  29.         GraphResult,ImageSize,InitGraph,Line,LineTo,MoveTo,OutText,
  30.          OutTextXY,PieSlice,PutImage,PutPixel,Rectangle,Sector,
  31.          SetActivePage,SetAspectRatio,SetbkColor,SetColor,
  32.          SetFillPattern,SetFillStyle,SetLineStyle,SetPalette,
  33.          SetTextJustify,SetTextStyle,SetUserCharSize,SetViewPort,
  34.          SetVisualPage,SetWriteMode,TextHeight,TextWidth,
  35.          GetArcCoords, GetFillSettings, GetLineSettings,
  36.          GetTextSettings, GetViewSettings, SetAllPalette,
  37.           GetCH,KbHit,KeyPressed,ReadKey);
  38.  
  39. TYPE
  40.    str_param = PACKED ARRAY [ 1..255 ] OF Char;
  41.    charptr = ^str_param;
  42.  
  43.    ptr_char = ^Char;
  44.    ptr_int  = ^Integer;
  45.  
  46. #ifdef __GPC__
  47.    u_int    =  __unsigned__ integer;
  48.    longint  =  __long__     integer;
  49.    u_long   =  __unsigned__ longint;
  50. #else
  51.    u_int    =  Integer; (* @@@ UNSIGNED INT *)
  52.    u_long   =  Integer; (* @@@ UNSIGNED LONG *)
  53. #endif { __GPC__ }
  54.  
  55.    Byte     =  0 .. 255;
  56.    SignedByte = -128 .. 127;
  57.  
  58.    colours  = (Black,    Blue,  Green,  Cyan, Red,  Magenta,    Brown,
  59.                LightGray, DarkGray,     LightBlue,  LightGreen, LightCyan,
  60.            LightRed,  LightMagenta, Yellow,     White);
  61.  
  62. TYPE
  63.    Fill_Types = (Empty_Fill,     Solid_Fill,      Line_Fill,      Ltslash_Fill,
  64.              Slash_Fill,     Bkslash_Fill,    Ltbkslash_Fill, Hatch_Fill,
  65.              Xhatch_Fill,    Interleave_Fill, Wide_Dot_Fill,
  66.              Close_Dot_Fill, User_Fill);
  67.  
  68.    Line_Types = (Solid_Line, Dotted_Line, Center_Line,
  69.              Dashed_Line, Userbit_Line);
  70.  
  71.    Widths     = (uw0,Norm_Width,uw2,Thick_Width);
  72.  
  73.   Lengths    = (ul0,ul1,DottedLine_Length,uw3,CentreLine_Length);
  74.  
  75. CONST
  76.    Dashedline_Length = DottedLine_Length;
  77.  
  78. TYPE
  79.    Fonts = (Default_Font, Triplex_Font, Small_Font,
  80.          Sansserif_Font, Gothic_Font);
  81.  
  82.    Directions = (Horiz_Dir, Vert_Dir);
  83.  
  84.    Text_Justify = (Left_Text, Center_Text, Right_Text);
  85.  
  86. CONST
  87.    Bottom_Text = Left_Text;
  88.    Top_Text    = Right_Text;
  89.  
  90. TYPE
  91.    puts      =  (Copy_Put, Xor_Put, Or_Put, And_Put, Not_Put);
  92.  
  93. CONST
  94.    Max_Pages = 4;
  95.  
  96. TYPE
  97.   ArcCoordsType =  RECORD
  98.              x,
  99.                 y,
  100.                 xStart,
  101.              yStart,
  102.              xEnd,
  103.              yEnd   :  Integer;
  104.            END;
  105.  
  106. { Date is reserved in Extended Pascal.
  107.   Use GetTimeStamp to get the date & time }
  108.  
  109.    rdate = RECORD
  110.          da_year : Integer;
  111.          da_day  ,
  112.          da_mon : Byte;
  113.        END;         
  114.  
  115.   FillSettingsType = RECORD
  116.                pattern,
  117.                color   : Integer;
  118.              END;
  119.  
  120.   LineSettingsType = RECORD
  121.                linestyle : integer;
  122.                upattern  : u_int;
  123.                thickness : integer;
  124.              END;
  125.  
  126.   PaletteType = RECORD
  127.           size    : Byte;
  128.           colours : PACKED ARRAY [ Colours ] OF SignedByte;
  129.         END;
  130.  
  131.   TextSettingsType = RECORD
  132.                font,
  133.                direction,
  134.                charsize,
  135.                horiz,
  136.                vert :  Integer;
  137.              END;
  138.  
  139.   ViewPortType = RECORD
  140.            left,
  141.            top,
  142.            right,
  143.            bottom,
  144.            clip :     Integer;
  145.          END;
  146.  
  147.   Borland_Info = RECORD
  148.            colour_index : Integer;
  149.            colour_name  : ptr_char;
  150.            pixel_values : u_long;
  151.          END;
  152.  
  153.  
  154.   PROCEDURE arc (x,y,stangle,endangle,radius : integer); C;
  155.   PROCEDURE bar (left,top,right,bottom: integer); C;
  156.   PROCEDURE bar3d (left,top,right,bottom,depth,topflag: integer); C;
  157.   PROCEDURE circle (x,y,radius: integer); C;
  158.   PROCEDURE cleardevice; C;
  159.   PROCEDURE clearviewport; C;
  160.   PROCEDURE closegraph; C;
  161.   PROCEDURE detectgraph (VAR driver, mode: integer); C;
  162.   PROCEDURE drawpoly (numpoints: integer; polypoints: ptr_int); C;
  163.   PROCEDURE fillellipse (a,b,c,d: integer); C;
  164.   PROCEDURE fillpoly (numpoints: integer; polypoints: ptr_int); C;
  165.   PROCEDURE floodfill (x,y,border: integer); C;
  166.   PROCEDURE getaspectratio (VAR xasp, yasp: integer); C;
  167.   FUNCTION  getbkcolor : integer; C;
  168.   FUNCTION  getcolor : integer; C;
  169.   PROCEDURE getfillsettings (VAR a : fillsettingstype); C;
  170.   PROCEDURE getfillpattern (VAR a: str_param); C;
  171.   PROCEDURE getimage (a,b,c,d : integer; e : ptr_char); C;
  172.   FUNCTION  getmaxcolor : integer; C;
  173.   FUNCTION  getmaxmode : integer; C;
  174.   FUNCTION  getmaxx : integer; C;
  175.   FUNCTION  getmaxy : integer; C;
  176.   FUNCTION  getmodename (a: integer) : ptr_char; C;
  177.   PROCEDURE getmoderange (a: integer; VAR b,c: integer); C;
  178.   FUNCTION  getpixel (a, b: integer) : u_int; C;
  179.   FUNCTION  getx : integer; C;
  180.   FUNCTION  gety : integer; C;
  181.   PROCEDURE graphdefaults; C;
  182.   FUNCTION  graphresult : integer; C;
  183.   FUNCTION  imagesize (a,b,c,d: integer) : u_int; C;
  184.   PROCEDURE initgraph (VAR a,b: integer; VAR c: str_param); C;
  185.   PROCEDURE line (a,b,c,d: integer); C;
  186.   PROCEDURE lineto (a, b: integer); C;
  187.   PROCEDURE moveto (a, b: integer); C;
  188.   PROCEDURE outtext (VAR c: str_param); C;
  189.   PROCEDURE outtextxy (x,y: integer; VAR c: str_param); C;
  190.   PROCEDURE pieslice (a,b,c,d,e: integer); C;
  191.   PROCEDURE putimage (a,b: integer; c: ptr_char; d: integer); C;
  192.   PROCEDURE putpixel (a,b,c: integer); C;
  193.   PROCEDURE rectangle (a,b,c,d: integer); C;
  194.   PROCEDURE sector (a,b,c,d,e,f    : integer); C;
  195.   PROCEDURE setactivepage (a: integer); C;
  196.   PROCEDURE setaspectratio (a, b: integer); C;
  197.   PROCEDURE setbkcolor (a: integer); C;
  198.   PROCEDURE setcolor (a: integer); C;
  199.   PROCEDURE setfillpattern (VAR    a: str_param; b: integer); C;
  200.   PROCEDURE setfillstyle (a, b: integer); C;
  201.   PROCEDURE setlinestyle (a: integer; b: u_int; c: integer); C;
  202.   PROCEDURE setpalette (a, b: integer); C;
  203.   PROCEDURE settextjustify (a, b: integer); C;
  204.   PROCEDURE settextstyle (a,b,c: integer); C;
  205.   PROCEDURE setusercharsize (a,b,c,d: integer); C;
  206.   PROCEDURE setviewport (a,b,c,d,e: integer); C;
  207.   PROCEDURE setvisualpage (a: integer); C;
  208.   PROCEDURE setwritemode (a: integer); C;
  209.   FUNCTION  textheight (VAR a: str_param) : integer; C;
  210.   FUNCTION  textwidth (VAR a: str_param) : integer; C;
  211.  
  212.   PROCEDURE getarccoords (VAR a    : arccoordstype); C;
  213.   PROCEDURE getlinesettings (VAR a : linesettingstype); C;
  214.   PROCEDURE gettextsettings (VAR a : textsettingstype); C;
  215.   PROCEDURE getviewsettings (VAR a : viewporttype); C;
  216.   PROCEDURE setallpalette (VAR a : palettetype); C;
  217.  
  218. {-------------------------------------------------------------------------}
  219.  
  220.   FUNCTION  getch : integer; C;
  221.   FUNCTION  kbhit : integer; C;
  222.  
  223.   { This should be done in a standard way in extended pascal.
  224.  
  225.     Anyway, the getdate routine is renamed to bgi_getdate(VAR a: rdate);
  226.     because it clashes with time.h
  227.   }
  228.    PROCEDURE bgi_getdate (VAR a : rdate); C;
  229.  
  230.    { the following simple routines added to xbgi library by Juki }
  231.    FUNCTION keypressed : integer; C;
  232.    FUNCTION readkey : char; C;
  233.  
  234.    FUNCTION param_argv (i: integer): charptr; C;
  235.    FUNCTION paramcount: integer; C;
  236.  
  237. { Here is ParamStr function:
  238.    
  239.        Type
  240.          mystring = string(100);
  241.  
  242.     Function ParamStr(a : Integer) : mystring;
  243.     begin
  244.        ParamStr := trim(param_argv (a)^);
  245.     end;
  246. }
  247.  
  248. end.
  249.